<link rel="stylesheet" href="assets/store/css/goods.css?v=<?= $version ?>">
<style>
    .table_box{
        min-width: 1000px;
    }

    .table_box .table-title{
        line-height: 30px;
    }

    .table_box th{
        display: block;
        padding:  3px;
    }
    .table_box .table-title th{
        width: 100%;
        text-align: center;
    }
    .table_box .table-fbt{
        width: 100%;
        line-height: 30px;
        text-align: left;
    }
    .table_box td{
        text-align: left;
        padding:0  3px;
        line-height: 40px;
        width: 9%;
        height: 40px;
    }
    .table_box tbody{
        display: table;
        width: 100%;
    }

    .table_box input{
        outline: 0;
        border: 0!important;
        padding-top: 0!important;
        padding-bottom: 0!important;
        line-height: 40px!important;
    }
    .table_box .short-input  span{
        float: left;
    }
    .table_box .short-input input{
        width: 40px !important;
        border: 0 !important;
        float: left;
    }
    .table_box .short-input-radio input{
        width: 20px;
        float: right;
    }
    .am-radio-inline{
        display: flex;
        align-items: center;
        float: left;
        padding-top: 0!important;
        justify-content: center;width: 100%;
    }
    .am-radio-inline .am-ucheck-icons{
        line-height: 20px!important;
    }
    </style>
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">基本信息</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-1 am-u-lg-1 am-form-label form-require"> 教练 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="goods[goods_name]"
                                           value="<?= $detail['coach']['real_name'] ?>" disabled>
                                </div>
                            </div>
                            <div class="tablebox">
                                <table class="table_box"  border="1" cellspacing="0" cellpadding="0">
                                   <thead>
                                   <tr class="table-title"><th><input type="text" name="fitness[title]" value="<?= $detail['title'];?>" placeholder="eg:身体组成分析报告" style="text-align: center"></th></tr>
                                   </thead>
                                    <tbody>
                                    <tr>
                                        <td class="short-input">
                                            <span>序号：</span>
                                        </td>
                                        <td>
                                            <span>姓名/ID</span>
                                        </td>
                                        <td><input type="text" v-model="user.name"></td>
                                        <td>
                                            <span>性别</span>
                                        </td>
                                        <td><input type="text" v-model="user.sex"></td>
                                        <td>
                                            <span>年龄</span>
                                        </td>
                                        <td><input type="text" v-model="user.age"></td>
                                        <td>
                                            <span>身高</span>
                                        </td>
                                        <td><input type="text" v-model="user.height"></td>
                                        <td>
                                            <span>日期/时间</span>
                                        </td>
                                        <td><input type="text" name="fitness[date]"
                                                   class="am-form-field"
                                                   value="<?= $detail['date'];?>" placeholder="体测时间" data-am-datepicker></td>
                                    </tr>
                                    <tr>
                                        <td colspan="5">1.身体成分分析</td>
                                        <td colspan="4">5.综合评估</td>
                                        <td colspan="2"></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>测量值</td>
                                        <td>去脂体重</td>
                                        <td>体重</td>
                                        <td>正常范围</td>
                                        <td colspan="5">营养评估</td>
                                    </tr>
                                    <tr>
                                        <td>身体水分含量kg</td>
                                        <td><input type="text" v-model="body_analysis.testing.water"></td>
                                        <td rowspan="3"><input type="text" v-model="body_analysis.fat_weight" style="height: 120px"></td>
                                        <td rowspan="4"><input type="text" v-model="body_analysis.weight" style="height: 160px"></td>
                                        <td><input type="text" v-model="body_analysis.normal.water"></td>
                                        <td>蛋白质</td>
                                        <td class="short-input"><span>正常</span></td>
                                        <td class="short-input"><span>缺乏</span></td>
                                        <td class="short-input"><span>过量</span></td>
                                        <td><input type="text" v-model="yingyang_analysis.danbaizhi"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>蛋白质kg</td>
                                        <td><input type="text" v-model="body_analysis.testing.danbaizhi"></td>
                                        <td><input type="text" v-model="body_analysis.normal.danbaizhi"></td>
                                        <td>无机盐</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="yingyang_analysis.wujiyan"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>无机盐kg</td>
                                        <td><input type="text" v-model="body_analysis.testing.wujiyan"></td>
                                        <td><input type="text" v-model="body_analysis.normal.wujiyan"></td>
                                        <td>脂肪</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="yingyang_analysis.zhifang"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>体脂肪kg</td>
                                        <td colspan="2"><input type="text" v-model="body_analysis.testing.tizhifang"></td>
                                        <td><input type="text" v-model="body_analysis.normal.tizhifang"></td>
                                        <td colspan="6">体重评估</td>
                                    </tr>
                                    <tr>
                                        <td colspan="5"></td>
                                        <td>体重</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="weight_analysis.weight"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td colspan="5">2.肌肉脂肪分析</td>
                                        <td>骨骼肌</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="weight_analysis.gugeji"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>低标准</td>
                                        <td>正常</td>
                                        <td>超标准</td>
                                        <td>正常范围</td>
                                        <td>脂肪</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="weight_analysis.zhifang"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>体重kg</td>
                                        <td ><input type="text" v-model="zhifang_analysis.weight.number1"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.weight.number2"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.weight.number3"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.weight.number4"></td>
                                        <td colspan="6">肥胖评估</td>
                                    </tr>
                                    <tr>
                                        <td>骨骼肌kg</td>
                                        <td ><input type="text" v-model="zhifang_analysis.gugeji.number1"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.gugeji.number2"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.gugeji.number3"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.gugeji.number4"></td>
                                        <td>身体质量参数</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="weight_analysis.body_param"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>体脂肪kg</td>
                                        <td ><input type="text" v-model="zhifang_analysis.tizhifang.number1"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.tizhifang.number2"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.tizhifang.number3"></td>
                                        <td ><input type="text" v-model="zhifang_analysis.tizhifang.number4"></td>
                                        <td>体脂百分数</td>
                                        <td class="short-input"><span>正常：</span></td>
                                        <td class="short-input"><span>缺乏：</span></td>
                                        <td class="short-input"><span>过量：</span></td>
                                        <td><input type="text" v-model="fat_assess.tizhi_per"></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td colspan="5"></td>
                                        <td colspan="6">6.重量控制</td>
                                    </tr>
                                    <tr>
                                        <td colspan="5">3肥胖分析</td>
                                        <td colspan="2">目标体重</td>
                                        <td colspan="2" class="short-input"><input style="width: 80%!important;" type="text" v-model="weight_ctrl.mubiao_weight"><span>kg</span></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>低标准</td>
                                        <td>正常</td>
                                        <td>超标准</td>
                                        <td>正常范围</td>
                                        <td colspan="2">体重控制</td>
                                        <td colspan="2" class="short-input"><input style="width: 80%!important;" type="text" v-model="weight_ctrl.weight_ctrl"><span>kg</span></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>身体质量参数</td>
                                        <td ><input type="text" v-model="fat_analysis.body_param.number1"></td>
                                        <td ><input type="text" v-model="fat_analysis.body_param.number2"></td>
                                        <td ><input type="text" v-model="fat_analysis.body_param.number3"></td>
                                        <td ><input type="text" v-model="fat_analysis.body_param.number4"></td>
                                        <td colspan="2">脂肪控制</td>
                                        <td colspan="2" class="short-input"><input style="width: 80%!important;" type="text" v-model="weight_ctrl.zhifang_ctrl"><span>kg</span></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>体脂百分数（%）</td>
                                        <td ><input type="text" v-model="fat_analysis.tizhi_per.number1"></td>
                                        <td ><input type="text" v-model="fat_analysis.tizhi_per.number2"></td>
                                        <td ><input type="text" v-model="fat_analysis.tizhi_per.number3"></td>
                                        <td ><input type="text" v-model="fat_analysis.tizhi_per.number4"></td>
                                        <td colspan="2">基础代谢</td>
                                        <td colspan="2" class="short-input"><input style="width: 80%!important;" type="text" v-model="weight_ctrl.jichudaixie"><span>kcal</span></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>腰臀脂肪比率（%）</td>
                                        <td ><input type="text" v-model="fat_analysis.yaotun_per.number1"></td>
                                        <td ><input type="text" v-model="fat_analysis.yaotun_per.number2"></td>
                                        <td ><input type="text" v-model="fat_analysis.yaotun_per.number3"></td>
                                        <td ><input type="text" v-model="fat_analysis.yaotun_per.number4"></td>
                                        <td colspan="2">健康评估</td>
                                        <td colspan="2" class="short-input"><input style="width: 80%!important;" type="text" v-model="weight_ctrl.jiankangpinggu"><span>分</span></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td>水份比率（%）</td>
                                        <td ><input type="text" v-model="fat_analysis.water_per.number1"></td>
                                        <td ><input type="text" v-model="fat_analysis.water_per.number2"></td>
                                        <td ><input type="text" v-model="fat_analysis.water_per.number3"></td>
                                        <td ><input type="text" v-model="fat_analysis.water_per.number4"></td>
                                        <td colspan="2">身体年龄</td>
                                        <td colspan="2" class="short-input"><input style="width: 80%!important;" type="text" v-model="weight_ctrl.age"></td>
                                        <td></td>
                                        <td></td>
                                    </tr>
                                    <tr>
                                        <td colspan="11"><p style="opacity: 0;">1</p></td>
                                    </tr>
                                    <tr>
                                        <td colspan="11">4.肥胖诊断</td>
                                    </tr>
                                    <tr>
                                    <tr>
                                        <?php foreach ($fat_config as $k=>$v): ?>
                                            <td>
                                                <label class="am-radio-inline">
                                                    <input type="radio" name="fat_zhenduan" v-model="fat_zhenduan" value="<?= $k; ?>" data-am-ucheck><?= $v; ?>
                                                </label>
                                            </td>
                                        <?php endforeach; ?>
                                    </tr>
                                    </tr>
<!--                                    <tr>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no1">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no2">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no3">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no4">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no5">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no6">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no7">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no8">-->
<!--                                        </td>-->
<!--                                        <td>-->
<!--                                            <input type="text" v-model="fat_zhen.no9">-->
<!--                                        </td>-->
<!--                                    </tr>-->
                                    </tbody>
                                </table>
                            </div>
                            <!-- 表单提交按钮 -->
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>

                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="assets/common/js/vue.min.js"></script>
<script src="assets/common/js/ddsort.js"></script>
<script src="assets/common/plugins/umeditor/umeditor.config.js?v=<?= $version ?>"></script>
<script src="assets/common/plugins/umeditor/umeditor.min.js"></script>
<script src="assets/store/js/goods.spec.js?v=<?= $version ?>"></script>
<script>

    $(function () {
        var setting = {
            el: 'many-app',
            baseData: null,
        };
        function Fitness(options){
            setting =  $.extend(true, {}, setting,options);
            this.initialize()
        }
        Fitness.prototype = {
            appVue:null,
            initialize:function () {
                var user = {
                    name:'',sex:'',age:'',height:'',
                },body_analysis={
                        testing:{water:'',danbaizhi:'',wujiyan:'',tizhifang:''},//测试值
                        fat_weight:'',
                        weight:'',
                        normal:{water:'',danbaizhi:'',wujiyan:'',tizhifang:''}
                    },
                    yingyang_analysis={danbaizhi:'',wujiyan:'',zhifang:''},
                    weight_analysis={weight:'',gugeji:'',zhifang:''},
                    zhifang_analysis={
                        weight:{number1:'',number2:'',number3:'',number4:''},
                        gugeji:{number1:'',number2:'',number3:'',number4:''},
                        tizhifang:{number1:'',number2:'',number3:'',number4:''},
                    },
                    fat_assess={body_param:'',tizhi_per:''},//肥胖评估
                    fat_analysis={
                        body_param:{number1:'',number2:'',number3:'',number4:''},
                        tizhi_per:{number1:'',number2:'',number3:'',number4:''},
                        yaotun_per:{number1:'',number2:'',number3:'',number4:''},
                        water_per:{number1:'',number2:'',number3:'',number4:''},
                    },
                    weight_ctrl={
                        mubiao_weight:'',
                        weight_ctrl:'',
                        zhifang_ctrl:'',
                        jichudaixie:'',
                        jiankangpinggu:'',
                        age:'',
                    },
                    fat_zhenduan=3,
                    fat_zhen={
                        no1:'',
                        no2:'',
                        no3:'',
                        no4:'',
                        no5:'',
                        no6:'',
                        no7:'',
                        no8:'',
                        no9:'',
                    };
                console.log(setting.baseData)
                if (typeof setting.baseData !== 'undefined' && setting.baseData !== null) {
                    user = setting.baseData['user'];
                    body_analysis = setting.baseData['body_analysis'];
                    yingyang_analysis = setting.baseData['yingyang_analysis'];
                    weight_analysis = setting.baseData['weight_analysis'];
                    zhifang_analysis = setting.baseData['zhifang_analysis'];
                    fat_assess = setting.baseData['fat_assess'];
                    fat_analysis = setting.baseData['fat_analysis'];
                    weight_ctrl = setting.baseData['weight_ctrl'];
                    fat_zhenduan = setting.baseData['fat_zhenduan'];
                    fat_zhen = setting.baseData['fat_zhen'];
                }
                this.appVue = new Vue({
                    el: '#my-form',
                    data: {
                        user:user,
                        body_analysis:body_analysis,
                        yingyang_analysis:yingyang_analysis,
                        weight_analysis:weight_analysis,
                        zhifang_analysis:zhifang_analysis,
                        fat_assess:fat_assess,//肥胖评估
                        fat_analysis:fat_analysis,
                        weight_ctrl:weight_ctrl,
                        fat_zhenduan:fat_zhenduan,
                        fat_zhen:fat_zhen,
                    },
                    methods:{
                        getData: function () {
                            return this.$data;
                        }
                    },
                })
            }
        }
        window.Fitness = Fitness
        // 注册商品多规格组件
        var specMany = new Fitness({
            el: '#my-form',
            baseData: <?= $detail['data']?>
        });

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm({
            // 获取多规格sku数据
            buildData: function () {
                var specData = specMany.appVue.getData();
                return {
                    fitness:{data:specData}
                };
            },
            // 自定义验证
            validation: function () {
                var title = $('input[name="fitness[title]"]').val();
                var date = $('input[name="fitness[date]"]').val();
                if (title === '' || title === undefined) {
                    layer.msg('请输入表头');
                    return false;
                }
                if (date === '' || date === undefined) {
                    layer.msg('请选择体测时间');
                    return false;
                }
                var specData = specMany.appVue.getData();
                if (specData.weight_ctrl.jiankangpinggu === '' || specData.weight_ctrl.jiankangpinggu === undefined){
                    layer.msg('请输入健康评估分');
                    return false;
                }
                return true;
            }
        });
    });
</script>
